import java.util.Scanner;


public class Packet implements IPacket {
	private final String classLabel = "Packet: ";

	static final int DUMMYINT = Integer.MIN_VALUE;
	static final String DUMMYSTRING = "dummy";
	int messageID;
	int packetID;
	int packetCount;
	String payload;
	
	/**
	 * Default constructor for Packet Class
	 */
	public Packet(){
		messageID=0;
		packetID=0;
		packetCount=0;
		payload="";
	}
	
	/**
	 * Accessors for Packet Class
	 */
	@Override
	public int getMessageID() {
		// TODO Auto-generated method stub
		return messageID;
	}

	@Override
	public int getPacketCount() {
		// TODO Auto-generated method stub
		return packetCount;
	}

	@Override
	public int getPacketID() {
		// TODO Auto-generated method stub
		return packetID;
	}

	@Override
	public String getPayload() {
		// TODO Auto-generated method stub
		return payload;
	}


	/** 
	 * Mutators for Packet Class
	 */
	@Override
	public void setMessageID(int what) {
		// TODO Auto-generated method stub
		messageID=what;
	}

	@Override
	public void setPacketCount(int what) {
		// TODO Auto-generated method stub
		packetCount=what;
	}

	@Override
	public void setPacketID(int what) {
		// TODO Auto-generated method stub
		packetID=what;
	}

	@Override
	public void setPayload(String what) {
		// TODO Auto-generated method stub
		payload=what;
	}
	
	/**
	 * Method readPacket takes a Scanner parameter that is a file of Packets and sets the attributes of the Packet and returns
	 * itself. Called in PacketAssembler class, (readPackets method)
	 */
	@Override
	public Packet readPacket(Scanner inFile) {
		// TODO Auto-generated method stub
		
	
		messageID=inFile.nextInt();
			this.setMessageID(messageID);
		
		packetID=inFile.nextInt();
			this.setPacketID(packetID);
		
		packetCount=inFile.nextInt();
			this.setPacketCount(packetCount);
		
		payload=inFile.nextLine();
			this.setPayload(payload);
	
	
		return this;
	}
	
	/**
	 * Method toString returns a String of the instance variables of this class
	 */
	public String toString(){
		String s ="";
		
		s+=messageID+"	";
		s+=packetID+"	";
		s+=packetCount+"	";
		s+=payload+"	";
		return s;
	}

}
